Skip to content

Fix annotation moving to the left when X axis PV changes#3579

Merged
georgweiss merged 2 commits into
ControlSystemStudio:masterfrom
mnabywan:fix_annotation_moving_when_xaxis_pv_changes
Oct 8, 2025
Merged

Fix annotation moving to the left when X axis PV changes#3579
georgweiss merged 2 commits into
ControlSystemStudio:masterfrom
mnabywan:fix_annotation_moving_when_xaxis_pv_changes

Conversation

@mnabywan

@mnabywan mnabywan commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

When on plot the X axis PV changes the way that here is no anymore the same x value, the annotation was choosing the last index before. We found the issue while using NTPVs on X and Y axis, which was recalculated every time in the IOC - so we never could find the same sample.

When X axis PV is changing every time, it was causing the issue that annotation was slowly going to the left and finally ending at the beginning.

Before:
image

Finding the closest sample instead should fix the issue (or at least limit it).

When on plot the X axis PV changes the way that
there is no anymore the same x value, the annotation was choosing
the last index before.
When X axis PV is changing every time, it was causing the issue
that annotation was slowly going to the left and finally ending at the
beginning.
Finding the closest sample instead should fix the issue.

@georgweiss georgweiss left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice with unit test(s), but since the other methods are not covered...

Would it be OK if I add unit tests to this class on your branch?

@mnabywan

mnabywan commented Oct 6, 2025

Copy link
Copy Markdown
Contributor Author

Of course!

That is possibly easier solution - instead of searching closest sample
every update call we first search for less-or-equal sample
and then greater-or-equal.
Thanks to that we should keep more or less the same position as in the
beginning.
@mnabywan

mnabywan commented Oct 7, 2025

Copy link
Copy Markdown
Contributor Author

Actually, I was testing annother approach and it may be simpler - instead of searching for closest sample, we can just alternate between less-or-equal and greated-or-equal sample.
Feel free to take a look.

@mnabywan mnabywan requested a review from georgweiss October 7, 2025 13:27
@georgweiss georgweiss merged commit e1f1ff2 into ControlSystemStudio:master Oct 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants